<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<!-- 
	Copyright (C) 2007, 2008, 2009, 2010, 2011. PARP Research Group.
	<http://perception.inf.um.es>
	University of Murcia, Spain.

	This file is part of the QVision library.

	QVision is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as
	published by the Free Software Foundation, version 3 of the License.

	QVision is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with QVision. If not, see <http://www.gnu.org/licenses/>.
-->

<html><head><meta http-equiv="content-Type" content="text/html;charset=UTF-8">
<title>QVision: Qt&#39;s Image, Video and Computer Vision Library</title>
<meta name="title" content="QVision" />
<meta name="dc.title" content="QVision" />
<meta name="url" content="http://perception.inf.um.es/QVision" />
<meta name="author" content="PARP Research Group - http://perception.inf.um.es" />
<meta name="revisit-after" content="30 DAYS"/>
<meta name="robots" content="index,follow"/>
<meta name="classification" content="*">
<meta name="rating" content="Safe For Kids">
<meta name="distribution" content="GLOBAL"/>
<meta name="description" content="Qt's Image, Video and Computer Vision Library"/>
<meta name="page-topic" content="Computer Vision research and prototype programming"/>
<meta name="geo.country" content="ES" />

<!--
Keywords:
By license:		open source, gnu, lgpl, gpl, free
By theme:		computer vision, image processing, robotics, programming, source, development
By usage:		library, toolkit, framework, prototype, application
By programming specs:	object oriented, c++, block programming, reusability, gui, graphical, parallel computing, high performance, GPU, prototyping
Interoperability with:	Qt, GSL, GNU Scientific library, OpenCV, CGAL, QWT, CUDA, mplayer, IPP, Intel Image Performance Primitives, blas, lapack
Functionallity:		image features, matrix algebra, projective geometry, mser, function minimization, function optimization, canny operator, harris operator, corner detection, performance evaluation, cpu usage, graphical interface
Main data-types:	matrix, vector, tensor, quaternion, image, polyline
Video sources:		webcam, camera, stream
Devices:		embedded, desktop computer, laptop, mini-laptop
Authors:		PARP research group. University of Murcia, Spain.
-->

<meta name="keywords" content="augmented reality, sfm, structure from motion, open source, gnu, lgpl, gpl, free, computer vision, image processing, robotics, programming, source, development, library, toolkit, framework, prototype, application, object oriented, c++, block programming, reusability, gui, graphical, parallel computing, high performance, GPU, prototyping, Qt, GSL, GNU Scientific library, OpenCV, CGAL, QWT, CUDA, mplayer, IPP, Intel Image Performance Primitives, blas, lapack, image features, matrix algebra, projective geometry, mser, function minimization, function optimization, canny operator, harris operator, corner detection, performance evaluation, cpu usage, graphical interface, matrix, vector, tensor, quaternion, image, polyline, webcam, camera, stream, embedded, desktop computer, laptop, mini-laptop, University of Murcia, Spain, PARP research group, vision por computador"/>
<meta http-equiv="keywords" content="augmented reality, sfm, structure from motion, open source, gnu, lgpl, gpl, free, computer vision, image processing, robotics, programming, source, development, library, toolkit, framework, prototype, application, object oriented, c++, block programming, reusability, gui, graphical, parallel computing, high performance, GPU, prototyping, Qt, GSL, GNU Scientific library, OpenCV, CGAL, QWT, CUDA, mplayer, IPP, Intel Image Performance Primitives, blas, lapack, image features, matrix algebra, projective geometry, mser, function minimization, function optimization, canny operator, harris operator, corner detection, performance evaluation, cpu usage, graphical interface, matrix, vector, tensor, quaternion, image, polyline, webcam, camera, stream, embedded, desktop computer, laptop, mini-laptop, University of Murcia, Spain, PARP research group, vision por computador"/>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="title" content="QVision"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="tabs.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="favicon.ico" />
</head><body>

<table width="100%"><tr>
	<td><a href="http://perception.inf.um.es/"><img src="parp.png" border="0" /> <big>PARP Research Group</big></a></td>
	<td align="right"><a href="http://www.um.es/"><big>Universidad de Murcia</big> <img src="um.png" border="0" /></a></td>
</tr></table>

<hr /><br />

<table width="95%" align="center"><tr><td>

<!-- Generated by Doxygen 1.6.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
          <form id="FSearchBox" action="search.php" method="get">
            <img id="MSearchSelect" src="search/search.png" alt=""/>
            <input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S" 
                   onfocus="searchBox.OnSearchFieldFocus(true)" 
                   onblur="searchBox.OnSearchFieldFocus(false)"/>
          </form>
        </div>
      </li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>QVDefaultGUI Class Reference<br/>
<small>
[<a class="el" href="group__qvqwt.html">GUI blocks based on the QWT library</a>]</small>
</h1><!-- doxytag: class="QVDefaultGUI" --><!-- doxytag: inherits="QVGUI" -->
<p>Main user interface widget for QVision applications.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="qvdefaultgui_8h_source.html">QVDefaultGUI</a>&gt;</code></p>

<p>Inherits <a class="el" href="classQVGUI.html">QVGUI</a>.</p>

<p><a href="classQVDefaultGUI-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQVDefaultGUI.html#a571b5d5e73ef8f174cbf9e9407ea7561">QVDefaultGUI</a> (QWidget *parent=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructs a <a class="el" href="classQVDefaultGUI.html" title="Main user interface widget for QVision applications.">QVDefaultGUI</a> object.  <a href="#a571b5d5e73ef8f174cbf9e9407ea7561"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Main user interface widget for QVision applications. </p>
<p>Class <a class="el" href="classQVDefaultGUI.html">QVDefaultGUI</a> is used in QVision applications to create a default GUI that offers the user the possibility to control the execution of the different blocks registered in the application, the flow of the input video camera objects, and modify the input parameters defined in them (and which are not linked to the output of other blocks, in whose case they obviously should not be controlled directly by the user).</p>
<p>A single instance object of the <a class="el" href="classQVDefaultGUI.html" title="Main user interface widget for QVision applications.">QVDefaultGUI</a> class should be created right after the <a class="el" href="classQVApplication.html">QVApplication</a> object in the <em>main</em> function, and before the call to <em>exec()</em>:</p>
<div class="fragment"><pre class="fragment"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[])
    {
    <a class="code" href="classQVApplication.html" title="Main class for QVision applications.">QVApplication</a> app(argc, argv,
        <span class="stringliteral">&quot;Example program for QVision library. Obtains several features from input video frames.&quot;</span>
        );

    <a class="code" href="classQVDefaultGUI.html" title="Main user interface widget for QVision applications.">QVDefaultGUI</a> interface;

    [...]

    <span class="keywordflow">return</span> app.exec();
    }
</pre></div><p>The following screenshot shows the main <a class="el" href="classQVDefaultGUI.html" title="Main user interface widget for QVision applications.">QVDefaultGUI</a> for a QVision example application:</p>
<div align="center">
<img src="qvisioninterface_default_gui.png" alt="qvisioninterface_default_gui.png"/>
</div>
<p>There are three main widget areas in the <a class="el" href="classQVDefaultGUI.html">QVDefaultGUI</a> window:</p>
<h2><a class="anchor" id="MenuArea">
A. Menu area</a></h2>
<p>Contains the Quit, Window and Help options. The first one, naturally, quits the application. The second is a typical window menu that allows the user to show/hide all the windows of the application. Finally, the last one shows a descriptive help of the application, as defined by the programmer when declaring the main <a class="el" href="classQVApplication.html" title="Main class for QVision applications.">QVApplication</a> object and the help text corresponding to the properties of the involved blocks. For example, here is the help window which is shown for an example application which contains, among some others, a Canny Operator Block:</p>
<div align="center">
<img src="qvisioninterface_help.png" alt="qvisioninterface_help.png"/>
</div>
<p>And here is some of the code responsible for the information shown:</p>
<div class="fragment"><pre class="fragment">[...]

<span class="keyword">class </span><a class="code" href="classQVCannyEdgeDetector.html">QVCannyEdgeDetector</a>: <span class="keyword">public</span> <a class="code" href="classQVProcessingBlock.html" title="Base class for Block threads.">QVProcessingBlock</a>
    {
    <a class="code" href="classQVCannyEdgeDetector.html">QVCannyEdgeDetector</a>(QString name): <a class="code" href="classQVProcessingBlock.html" title="Base class for Block threads.">QVProcessingBlock</a>(name)
        {
        addProperty&lt;double&gt;(<span class="stringliteral">&quot;cannyHigh&quot;</span>, inputFlag, 150, <span class="stringliteral">&quot;High threshold for Canny operator&quot;</span>, 50, 1000);
        addProperty&lt;double&gt;(<span class="stringliteral">&quot;cannyLow&quot;</span>, inputFlag, 50, <span class="stringliteral">&quot;Low threshold for Canny operator&quot;</span>, 10, 500);
        addProperty&lt;bool&gt;(<span class="stringliteral">&quot;applyIPE&quot;</span>, inputFlag, FALSE, <span class="stringliteral">&quot;If we want to apply the IPE algorithm&quot;</span>);
        addProperty&lt;double&gt;(<span class="stringliteral">&quot;paramIPE&quot;</span>, inputFlag, 5.0, <span class="stringliteral">&quot;IPE parameter (max. allowed distance to line)&quot;</span>, 1.0, 25.0);
        addProperty&lt;bool&gt;(<span class="stringliteral">&quot;intersectLines&quot;</span>, inputFlag, TRUE, <span class="stringliteral">&quot;If we want IPE to postprocess polyline (intersecting lines)&quot;</span>);
        addProperty&lt;int&gt;(<span class="stringliteral">&quot;minLengthContour&quot;</span>, inputFlag, 25, <span class="stringliteral">&quot;Minimal length of a contour to be considered&quot;</span>, 1, 150);
        addProperty&lt;int&gt;(<span class="stringliteral">&quot;showNothingCannyImage&quot;</span>, inputFlag, 0, <span class="stringliteral">&quot;If we want nothing|Canny|original image to be shown&quot;</span>,0,2);
        addProperty&lt;bool&gt;(<span class="stringliteral">&quot;showContours&quot;</span>, inputFlag, TRUE, <span class="stringliteral">&quot;If we want contours to be shown&quot;</span>);

        addProperty&lt; QVImage&lt;uChar,1&gt; &gt;(<span class="stringliteral">&quot;Output image&quot;</span>, outputFlag);
        addProperty&lt; QVImage&lt;uChar,3&gt; &gt;(<span class="stringliteral">&quot;Input image&quot;</span>, inputFlag|outputFlag);
        addProperty&lt; QList&lt;QVPolyline&gt; &gt;(<span class="stringliteral">&quot;Output contours&quot;</span>, outputFlag);
        }

    [...]

    }

<span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[])
    {
    <a class="code" href="classQVApplication.html" title="Main class for QVision applications.">QVApplication</a> app(argc, argv,
        <span class="stringliteral">&quot;Example program for QVision library. Obtains several features from input video frames.&quot;</span>
        );
    [...]

    <a class="code" href="classQVCannyEdgeDetector.html">QVCannyEdgeDetector</a> cannyBlock(<span class="stringliteral">&quot;Canny Operator Block&quot;</span>);

    [...]

    QVMPlayerCamera camera(<span class="stringliteral">&quot;Video&quot;</span>);

    [...]

    }
</pre></div><p>Several important facts should be noted here:</p>
<ul>
<li>The main help of the application is defined when declaring the <a class="el" href="classQVApplication.html" title="Main class for QVision applications.">QVApplication</a> object in the main() function.</li>
<li>Only input properties of the block are documented, and thus appear in the help window.</li>
<li>There are several input properties that are present in every block, because they are inherited from the base <a class="el" href="classQVProcessingBlock.html" title="Base class for Block threads.">QVProcessingBlock</a> class (for example, the first three properties which appear in the help for the Canny Operator Block).</li>
<li>The QVMPlayerCamera object (which is the input block which provides a continuous image source for other blocks) has also its associated help, with convenient input properties (number of rows, columns, and so on). In fact, it is internally just a special kind of block, and as such, it is treated here just the same way.</li>
</ul>
<h2><a class="anchor" id="BlocksArea">
B. Blocks area</a></h2>
<p>This area contains a tabbed widget for every block in our application. By selecting the adequate tab, we can access to both input and output parameters of the selected block. Each of these widgets is connected to a corresponding property of the block (only if they are not linked to other blocks, of course). The user can thus modify the values of every unlinked input parameter at will in execution time.</p>
<p>The <a class="el" href="classQVDefaultGUI.html">QVDefaultGUI</a> object literally discover every dynamic property contained in each block object (thanks to the <em>self introspection</em> technique), and conveniently offer the adequate widget (slider, button, checkbox, edit widget, or a combination of them) to the user to inspect and modify their corresponding values at execution time (as well as through the command line, during the initialization of the application). QVision has predefined widgets for dynamic properties of common basic types, such as boolean, integer, double, character string, etc.</p>
<p>The developer of a block class, then, just has to take care of declaring the parameters of the algorithms he wants to be modificable by the user at execution time as dynamic properties contained in the block object, of the input type (declaring them using the <em>InputFlag</em> flag). The introspection mechanism takes care of all the rest. Take, for example, the constructor of the following Canny edge detector block:</p>
<div class="fragment"><pre class="fragment">[...]

<span class="keyword">class </span><a class="code" href="classQVCannyEdgeDetector.html">QVCannyEdgeDetector</a>: <span class="keyword">public</span> <a class="code" href="classQVProcessingBlock.html" title="Base class for Block threads.">QVProcessingBlock</a>
    {
    <span class="keyword">public</span>:
        <a class="code" href="classQVCannyEdgeDetector.html">QVCannyEdgeDetector</a>(QString name): <a class="code" href="classQVProcessingBlock.html" title="Base class for Block threads.">QVProcessingBlock</a>(name)
            {
            addProperty&lt;double&gt;(<span class="stringliteral">&quot;cannyHigh&quot;</span>, inputFlag, 150, <span class="stringliteral">&quot;High threshold for Canny operator&quot;</span>, 50, 1000);
            addProperty&lt;double&gt;(<span class="stringliteral">&quot;cannyLow&quot;</span>, inputFlag, 50, <span class="stringliteral">&quot;Low threshold for Canny operator&quot;</span>, 10, 500);
            [...]
            }

        <span class="keywordtype">void</span> iterate()
            {
            [...]
            }
    }
</pre></div><p>Observe that two double input properties are declared. Let us concentrate on the first one. It needs a name ("cannyHigh"), the aforementioned <em>inputFlag</em> flag (which declares it as an input parameter for the block), a default value (150), a short description, and an interval for valid values ([50,1000]). With just this property declaration in the constructor of the block, the default GUI generated by QVision will generate an adequate input widget that will allow the user to dynamically change the property value during execution. There are also default input widgets for int, bool and Qstring types. See, for example, the following snapshot, corresponding to a QVision application with a Canny block, which contains several input properties of bool, int, and double types:</p>
<div align="center">
<img src="qvisioninterface_input_widgets.png" alt="qvisioninterface_input_widgets.png"/>
</div>
<p>Once the input properties of each block have been conveniently declared in the corresponding constructors, input widgets will be created automatically by simple declaration of a <a class="el" href="classQVDefaultGUI.html">QVDefaultGUI</a> instance in the main function.</p>
<p>In the tab of each block, there is also a control area, which allows us to pause, resume, and stop the execution for the block, as well as accessing to a time statistics widget.</p>
<p>Here is a list with the detailed description of the buttons and their functionality:</p>
<table class="doxtable">
<tr>
<td><b>Pause button</b>  </td><td width="5%"><div align="center">
<img src="qvisioninterface_pause.png" alt="qvisioninterface_pause.png"/>
</div>
 </td><td><p class="starttd">This button suspends the processing of the block. Every block synchronized with it will be stopped as well, until the resume button is pushed.</p>
<p class="endtd"></p>
</td></tr>
<tr>
<td><b>Resume button</b>  </td><td><div align="center">
<img src="qvisioninterface_play.png" alt="qvisioninterface_play.png"/>
</div>
 </td><td><p class="starttd">If the block is paused, pushing this button resumes its execution.</p>
<p class="endtd"></p>
</td></tr>
<tr>
<td><b>Step button</b>  </td><td><div align="center">
<img src="qvisioninterface_step.png" alt="qvisioninterface_step.png"/>
</div>
 </td><td><p class="starttd">This button can be pushed when a block is paused to make it iterate just once again (i.e., it executes a complete iteration and pauses again).</p>
<p class="endtd"></p>
</td></tr>
<tr>
<td><b>Stop button</b>  </td><td><div align="center">
<img src="qvisioninterface_stop.png" alt="qvisioninterface_stop.png"/>
</div>
 </td><td><p class="starttd">This button finishes the processing of the block. Its properties will be automatically unlinked and frozen, so any block connected to them will keep on reading the same (frozen) values from then on.</p>
<p class="endtd"></p>
</td></tr>
<tr>
<td><b>CPU statistics button</b>  </td><td><div align="center">
<img src="qvisioninterface_cpustats.png" alt="qvisioninterface_cpustats.png"/>
</div>
 </td><td>This button opens a detailed cpu usage plot for the block. It opens a window displaying the cpu time statistical plot of the time flags defined in the <em>iterate()</em> function of the block. You can see an example of this plot and how to set up time flags for performance inspection in section TimeFlags below. </td></tr>
</table>
<h2><a class="anchor" id="CamerasArea">
C. Cameras area</a></h2>
<p>Analogous to the blocks area, this is another tabbed widget with a tab for each camera declared in the QVision application (in fact, internally they are just special kind of blocks). Here we can pause, resume, and stop the video input flow, as well as reopening the source (video file, camera, or whatever) changing the desired parameters (size, deinterlacing or whatever).</p>
<p>Here is a description of the main camera control buttons and their functionality:</p>
<table class="doxtable">
<tr>
<td><b>Pause button</b>  </td><td width="5%"><div align="center">
<img src="qvisioninterface_pause.png" alt="qvisioninterface_pause.png"/>
</div>
 </td><td><p class="starttd">This button stops the camera from "publishing" new frames from the video source (if the camera is on real-time mode it will keep reading frames, but won't send them to the blocks connected to it; for video files and non-realtime mode, the video will be effectively paused; in any case, connected blocks will keep on receiving the same paused frame).</p>
<p class="endtd"></p>
</td></tr>
<tr>
<td><b>Resume button</b>  </td><td><div align="center">
<img src="qvisioninterface_play.png" alt="qvisioninterface_play.png"/>
</div>
 </td><td><p class="starttd">This button resumes grabbing.</p>
<p class="endtd"></p>
</td></tr>
<tr>
<td><b>Step button</b>  </td><td><div align="center">
<img src="qvisioninterface_step.png" alt="qvisioninterface_step.png"/>
</div>
 </td><td><p class="starttd">When the camera is paused, this button makes it read the next frame in the video input, keeping the camera paused afterwards.</p>
<p class="endtd"></p>
</td></tr>
<tr>
<td><b>Stop button</b>  </td><td><div align="center">
<img src="qvisioninterface_stop.png" alt="qvisioninterface_stop.png"/>
</div>
 </td><td><p class="starttd">This button stops the camera from reading frames from the input source. The camera must be reopened to work again.</p>
<p class="endtd"></p>
</td></tr>
</table>
<p>Here is an screenshot of the camera widget interface:</p>
<div align="center">
<img src="qvisioninterface_camera.png" alt="qvisioninterface_camera.png"/>
</div>
<p>Observe that you can easily change the input video source at execution time, by reopening it with the new desired URL, size and features (deinterlacing and loop mode). The widget also provides some pieces of information on the video source, such as the current position, video size and FPS. Finally, and of course just for video files, the user can also use the position slider to directly move the video source to a desired time position. </p>

<p>Definition at line <a class="el" href="qvdefaultgui_8h_source.html#l00212">212</a> of file <a class="el" href="qvdefaultgui_8h_source.html">qvdefaultgui.h</a>.</p>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a571b5d5e73ef8f174cbf9e9407ea7561"></a><!-- doxytag: member="QVDefaultGUI::QVDefaultGUI" ref="a571b5d5e73ef8f174cbf9e9407ea7561" args="(QWidget *parent=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QVDefaultGUI::QVDefaultGUI </td>
          <td>(</td>
          <td class="paramtype">QWidget *&nbsp;</td>
          <td class="paramname"> <em>parent</em> = <code>0</code></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Constructs a <a class="el" href="classQVDefaultGUI.html" title="Main user interface widget for QVision applications.">QVDefaultGUI</a> object. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>parent</em>&nbsp;</td><td>(Optional) parent for the created widget </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="qvdefaultgui_8cpp_source.html#l00042">42</a> of file <a class="el" href="qvdefaultgui_8cpp_source.html">qvdefaultgui.cpp</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/qvblockprogramming/qvguiblocks/<a class="el" href="qvdefaultgui_8h_source.html">qvdefaultgui.h</a></li>
<li>src/qvblockprogramming/qvguiblocks/<a class="el" href="qvdefaultgui_8cpp_source.html">qvdefaultgui.cpp</a></li>
</ul>
</div>
</td></tr></table>

<br /><hr><br />
<center><a href="http://perception.inf.um.es/QVision">QVision framework</a>.
<a href="http://perception.inf.um.es">PARP research group</a>.
Copyright &copy; 2007, 2008, 2009, 2010, 2011.</center>
<br />
</body>
</html>
